<script>
import outMain from "@/components/outMain.vue";
import { ElMessage, ElMessageBox } from "element-plus";

import { noticeDetails } from "@/http/api";
export default {
  components: { outMain },
  name: "",
  data() {
    return {
      detailId: this.$route.query.id,
      formData: {},
      showCont: false,
    };
  },
  props: {},
  setup() {},
  methods: {
    getData() {
      noticeDetails({ article_id: this.detailId }).then((res) => {
        if (res.data.code == 1) {
          this.formData = res.data.data;
          this.showCont = true;
        }
      });
    },
    changeArt(id) {
      this.$router.push({ path: "/artDetail", query: { id: id } });
      this.detailId = id;
      this.getData();
    },
  },
  mounted() {},
  created() {
    this.getData();
  },
};
</script>
<template>
  <outMain>
    <div class="formCont" v-if="showCont">
      <div class="formStep">
        <div class="formHead">
          <div>公告详情</div>
          <btn value="返回上一级"></btn>
        </div>
        <div class="artCont">
          <div class="artHead">
            <div class="artTitle">{{ formData.content.article_title }}</div>
            <div class="artTime">
              发布时间：{{ formData.content.create_time }}
            </div>
            <div class="artMain">{{ formData.content.article_content }}</div>
          </div>
          <div class="artFoot">
            <div class="linkText_">
              <div
                class="artFootItem"
                v-if="formData.prevArticle"
                @click="changeArt(formData.prevArticle.article_id)"
              >
                上一篇：{{ formData.prevArticle.article_title }}
              </div>
            </div>
            <div class="linkText_">
              <div
                class="artFootItem"
                v-if="formData.nextArticle"
                @click="changeArt(formData.nextArticle.article_id)"
              >
                下一篇：{{ formData.nextArticle.article_title }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </outMain>
</template>
<style scoped lang="less"></style>
